﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using GA.Utils;

namespace HQ.Web.Handlers
{
    /// <summary>
    /// Summary description for BaseHandler
    /// </summary>
    public class BaseHandler : IHttpHandler
    {
        public HttpContext Context { get; set; }

        public void ProcessRequest(HttpContext context)
        {
            this.Context = context;
            try
            {
                this.Process();
            }
            catch (Exception e)
            {
                LogHelper.Write("后台程序发生异常，请联系管理员！", e);
                Context.Response.ContentType = "text/plain";
                Context.Response.Write("error");
            }

        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

        public virtual void Process()
        {

            Context.Response.ContentType = "text/plain";
            Context.Response.Write("write your own process.");
        }

    }
}